package tms.model;

import java.util.Calendar;
import java.util.Date;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement
public class Account{

    public static final String TABLE_NAME = "Account";
    public static String[] columns = {"FirstName", "LastName", "Email", "PIDnumber", "Address", "Phone", "IsActive", "FFNumber",
            "FFScore", "Password", "Username", "City", "Province", "Country", "PassportNumber",
            "Title", "IssuingCountry", "AccountNumber", "RegistrationDay", "RegistrationMonth", "RegistrationYear",
            "BirthDay", "BirthMonth", "BirthYear" };

    private int id = -1;
    private String firstName = "";
    private String lastName = "";
    private String email = "";
    private String pidNumber = "";
    private String address = "";
    private String phone = "";
    private boolean isActive = false;
    private String ffNumber = "";
    private int ffScore = 0;
    private String password = "";
    private String username = "";
    private String city = "";
    private String province = "";
    private String country = "";
    private String passportNumber = "";
    private String title = "";
    private String issuingCountry = "";
    private String accountNumber = "";

    private int regDay = 1;
    private int regMonth = 1;
    private int regYear = 2013;

    private int bDay = 1;
    private int bMonth = 1;
    private int bYear = 1980;

    public String getFullName() {
        return firstName + " " + lastName;
    }

    /****************************************************************************/

    @XmlElement
    public int getId() {
        return id;
    }

    public void setId(int id){
    	this.id = id;
    }
    
    @XmlElement
    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    @XmlElement
    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    @XmlElement
    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    @XmlElement
    public String getPidNumber() {
        return pidNumber;
    }

    public void setPidNumber(String pidNumber) {
        this.pidNumber = pidNumber;
    }

    @XmlElement
    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    @XmlElement
    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    @XmlElement
    public boolean isActive() {
        return isActive;
    }

    public void setActive(boolean isActive) {
        this.isActive = isActive;
    }

    @XmlElement
    public String getFfNumber() {
        return ffNumber;
    }

    public void setFfNumber(String ffNumber) {
        this.ffNumber = ffNumber;
    }

    @XmlElement
    public int getFfScore() {
        return ffScore;
    }

    public void setFfScore(int ffScore) {
        this.ffScore = ffScore;
    }

    /**
     * @return Registration date without time
     */
    public Date getRegistrationDate() {
        Calendar c = Calendar.getInstance();
        c.set(getRegYear(), getRegMonth() - 1, getRegDay());
        return c.getTime();
    }

    public void setRegistrationDate(Date date) {
        Calendar c = Calendar.getInstance();
        c.setTime(date);
        setRegDay(c.get(Calendar.DAY_OF_MONTH));
        setRegMonth(c.get(Calendar.MONTH) + 1);
        setRegYear(c.get(Calendar.YEAR));
    }

    @XmlElement
    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @XmlElement
    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    @XmlElement
    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    @XmlElement
    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    @XmlElement
    public String getCountry() {
        return country;
    }

    public void setCountry(String country) {
        this.country = country;
    }

    @XmlElement
    public String getPassportNumber() {
        return passportNumber;
    }

    public void setPassportNumber(String passportNumber) {
        this.passportNumber = passportNumber;
    }

    @XmlElement
    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    /**
     * @return Birth date without time
     */
    public Date getBirthDate() {
        Calendar c = Calendar.getInstance();
        c.set(getbYear(), getbMonth() - 1, getbDay());
        return c.getTime();
    }

    public void setBirthDate(Date date) {
        Calendar c = Calendar.getInstance();
        c.setTime(date);
        setbDay(c.get(Calendar.DAY_OF_MONTH));
        setbMonth(c.get(Calendar.MONTH) + 1);
        setbYear(c.get(Calendar.YEAR));
    }

    @XmlElement
    public String getIssuingCountry() {
        return issuingCountry;
    }

    public void setIssuingCountry(String issuingCountry) {
        this.issuingCountry = issuingCountry;
    }

    @XmlElement
    public String getAccountNumber() {
        return accountNumber;
    }

    public void setAccountNumber(String accountNumber) {
        this.accountNumber = accountNumber;
    }

    @XmlElement
    public int getRegDay() {
        return regDay;
    }

    private void setRegDay(int regDay) {
        this.regDay = regDay;
    }

    @XmlElement
    public int getRegMonth() {
        return regMonth;
    }

    private void setRegMonth(int regMonth) {
        this.regMonth = regMonth;
    }

    @XmlElement
    public int getRegYear() {
        return regYear;
    }

    private void setRegYear(int regYear) {
        this.regYear = regYear;
    }

    @XmlElement
    public int getbDay() {
        return bDay;
    }

    private void setbDay(int bDay) {
        this.bDay = bDay;
    }

    @XmlElement
    public int getbMonth() {
        return bMonth;
    }

    private void setbMonth(int bMonth) {
        this.bMonth = bMonth;
    }

    @XmlElement
    public int getbYear() {
        return bYear;
    }

    private void setbYear(int bYear) {
        this.bYear = bYear;
    }

}
